package com.example.roomjavademo.view_model;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;

import com.example.roomjavademo.entity.UserBean;
import com.example.roomjavademo.repository.UserRepository;

import java.util.List;

public class UserViewModel extends AndroidViewModel {
    private final UserRepository mUserRepository;


    public UserViewModel(@NonNull Application application) {
        super(application);
        mUserRepository = new UserRepository(application);
    }

    public LiveData<List<UserBean>> getListLiveData() {
        return mUserRepository.getListLiveData();
    }

    public void insert(UserBean... userBeans) {
        mUserRepository.insert(userBeans);
    }

    public void delete(UserBean... userBeans) {
        mUserRepository.delete(userBeans);
    }

    public void deleteAll() {
        mUserRepository.deleteAll();
    }

    public void update(UserBean... userBeans) {
        mUserRepository.update(userBeans);
    }
}
